package com.sisyphus.spinach.helper.validation;

import android.widget.TextView;

/**
 * 相同
 */
public class FormSame implements IFormRule {

    private final CharSequence param1;
    private final CharSequence param2;
    private       String       errorMessage;

    public FormSame(TextView param1, TextView param2, String errorMessage) {
        this(param1.getText(), param2.getText(), errorMessage);
    }

    public FormSame(CharSequence param1, CharSequence param2, String errorMessage) {
        this.param1 = param1;
        this.param2 = param2;
        this.errorMessage = errorMessage;
    }

    @Override
    public boolean validation() {
        return param1.equals(param2);
    }

    @Override
    public CharSequence getErrorMessage() {
        return errorMessage;
    }
}
